from biz_code.component.comm import public_utils


async def employee_qry(params: dict, conn_id):

    params["password"] = public_utils.employee_password_md5(params["password"])

    sql = "select employee_number as user_code from employee where employee_number = %s and login_pwd = %s"
    sql_params = (params["employee_number"], params["password"])
    data = await conn_id.query(sql, *sql_params)

    if len(data) < 1:
        raise Exception("登录失败，未找到该用户")

    return data
